{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<div class=\"contentcontainer med left\" style=\"margin-left: -50px;\">\n",
    "<dl class=\"dl-horizontal\">\n",
    "  <dt>Title</dt> <dd>Layout Container</dd>\n",
    "  <dt>Dependencies</dt> <dd>Plotly</dd>\n",
    "  <dt>Backends</dt> <dd><a href='./Layout.ipynb'>Bokeh</a></dd> <dd><a href='../matplotlib/Layout.ipynb'>Matplotlib</a></dd> <dd><a href='../plotly/Layout.ipynb'>Plotly</a></dd>\n",
    "</dl>\n",
    "</div>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import holoviews as hv\n",
    "hv.extension('plotly')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "A Layout is a collection of HoloViews objects that are related in some way, to be displayed side-by-side. Like [``Overlay``](./Overlay.ipynb) and unlike other containers such as [``HoloMap``](./HoloMap.ipynb) , [``GridSpace``](./GridSpace.ipynb) and [``NdLayout``](./NdLayout.ipynb) a ``Layout`` is *not* dictionary like: it holds potentially heterogeneous types without any dimensioned keys.\n",
    "\n",
    "\n",
    "A ``Layout`` cannot contain ``NdLayouts`` but can otherwise contain *any* other HoloViews object. See [Building Composite Objects](../../../user_guide/06-Building_Composite_Objects.ipynb) for more details on how to compose containers. It is best to learn about ``Layout`` and [``Overlay``](./Overlay.ipynb) together as they are very closely related objects that share many core concepts."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### ``Layout`` is a heterogeneous collection"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "You can build a ``Layout`` between any two HoloViews objects (which can have different types) using the ``+`` operator:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "xvals = [0.1* i for i in range(100)]\n",
    "curve =  hv.Curve((xvals, [np.sin(x) for x in xvals]))\n",
    "scatter =  hv.Scatter((xvals[::5], np.linspace(0,1,20)))\n",
    "curve + scatter"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "In this example, we have a ``Layout`` composed of a ``Curve`` element and a ``Scatter`` element. The one restriction on what you can put in a ``Layout`` is that you cannot combine an [``NdLayout``](./NdLayout.ipynb) with a regular ``Layout``.\n",
    "\n",
    "For more information about both ``Layout`` and ``Overlay``, see the [Composing_Elements](../../../user_guide/02-Composing_Elements.ipynb) user guide."
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python",
   "pygments_lexer": "ipython3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
